<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/checklist/db" VERSION="20120920" COMMENT="XMLDB file for Moodle mod/checklist"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
  <TABLES>
    <TABLE NAME="checklist" COMMENT="main checklist table" NEXT="checklist_item">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="course"/>
        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="name"/>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="course" NEXT="intro"/>
        <FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="introformat"/>
        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="intro" NEXT="timecreated"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="introformat" NEXT="timemodified"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated" NEXT="useritemsallowed"/>
        <FIELD NAME="useritemsallowed" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="1" SEQUENCE="false" COMMENT="Whether or not users are allowed to add their own items to the checklist" PREVIOUS="timemodified" NEXT="teacheredit"/>
        <FIELD NAME="teacheredit" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Whether the marking will be done by: 0 - students only (default), 1 - teacher only; 2 - both teacher and student" PREVIOUS="useritemsallowed" NEXT="theme"/>
        <FIELD NAME="theme" TYPE="char" LENGTH="100" NOTNULL="false" DEFAULT="default" SEQUENCE="false" COMMENT="The theme chosen to display the checklist to the users" PREVIOUS="teacheredit" NEXT="duedatesoncalendar"/>
        <FIELD NAME="duedatesoncalendar" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Add due dates to the course calendar" PREVIOUS="theme" NEXT="teachercomments"/>
        <FIELD NAME="teachercomments" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="1" SEQUENCE="false" COMMENT="Are teachers allowed to add comments to a user's checklist items?" PREVIOUS="duedatesoncalendar" NEXT="maxgrade"/>
        <FIELD NAME="maxgrade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" PREVIOUS="teachercomments" NEXT="autopopulate"/>
        <FIELD NAME="autopopulate" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Automatically fill in the checklist, based on the modules in the current course" PREVIOUS="maxgrade" NEXT="autoupdate"/>
        <FIELD NAME="autoupdate" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="1" SEQUENCE="false" COMMENT="Automatically update items that are linked to course modules (tick them off when items are complete)" PREVIOUS="autopopulate" NEXT="completionpercent"/>
        <FIELD NAME="completionpercent" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Percentage of items that need to be checked off before the checklist is regarded as complete" PREVIOUS="autoupdate" NEXT="emailoncomplete"/>
        <FIELD NAME="emailoncomplete" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Whether or not to email teachers when a checklist is completed" PREVIOUS="completionpercent" NEXT="lockteachermarks"/>
        <FIELD NAME="lockteachermarks" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="If true, then teachers will be unable to change marks after saving a 'yes'" PREVIOUS="emailoncomplete"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="mdl_chec_cou_ix" UNIQUE="false" FIELDS="course"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="checklist_item" COMMENT="Records the items in the checklist" PREVIOUS="checklist" NEXT="checklist_check">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="checklist"/>
        <FIELD NAME="checklist" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="userid"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="checklist" NEXT="displaytext"/>
        <FIELD NAME="displaytext" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="userid" NEXT="position"/>
        <FIELD NAME="position" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="displaytext" NEXT="indent"/>
        <FIELD NAME="indent" TYPE="int" LENGTH="8" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="position" NEXT="itemoptional"/>
        <FIELD NAME="itemoptional" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="indent" NEXT="duetime"/>
        <FIELD NAME="duetime" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Date/time when this item is due to be completed" PREVIOUS="itemoptional" NEXT="eventid"/>
        <FIELD NAME="eventid" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="id of the calendar event (if any) associated with this item" PREVIOUS="duetime" NEXT="colour"/>
        <FIELD NAME="colour" TYPE="char" LENGTH="15" NOTNULL="true" DEFAULT="black" SEQUENCE="false" PREVIOUS="eventid" NEXT="moduleid"/>
        <FIELD NAME="moduleid" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="id of the course module (if any) associated with this item" PREVIOUS="colour" NEXT="hidden"/>
        <FIELD NAME="hidden" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether or not the item should be hidden from students" PREVIOUS="moduleid" NEXT="grouping"/>
        <FIELD NAME="grouping" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Grouping that the item's module belongs to" PREVIOUS="hidden"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="userid" UNIQUE="false" FIELDS="userid" NEXT="checklist"/>
        <INDEX NAME="checklist" UNIQUE="false" FIELDS="checklist" PREVIOUS="userid" NEXT="item_module"/>
        <INDEX NAME="item_module" UNIQUE="false" FIELDS="moduleid" PREVIOUS="checklist"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="checklist_check" COMMENT="Records when items where checked off" PREVIOUS="checklist_item" NEXT="checklist_comment">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="item"/>
        <FIELD NAME="item" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="userid"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The user that checked this item" PREVIOUS="item" NEXT="usertimestamp"/>
        <FIELD NAME="usertimestamp" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="userid" NEXT="teachermark"/>
        <FIELD NAME="teachermark" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="usertimestamp" NEXT="teachertimestamp"/>
        <FIELD NAME="teachertimestamp" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="teachermark" NEXT="teacherid"/>
        <FIELD NAME="teacherid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The userid of the teacher who updated this checkmark" PREVIOUS="teachertimestamp"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="item" UNIQUE="false" FIELDS="item" NEXT="userid"/>
        <INDEX NAME="userid" UNIQUE="false" FIELDS="userid" PREVIOUS="item"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="checklist_comment" COMMENT="A comment, added by a teacher, to an item on a user's checklist" PREVIOUS="checklist_check">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="itemid"/>
        <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The id of the item this comment is attached to" PREVIOUS="id" NEXT="userid"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The id of the user on whose checklist this comment has been added" PREVIOUS="itemid" NEXT="commentby"/>
        <FIELD NAME="commentby" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="The userid of the teacher who has added the comment" PREVIOUS="userid" NEXT="text"/>
        <FIELD NAME="text" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="The text of the comment, as added by the teacher" PREVIOUS="commentby"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="checklist_item_user" UNIQUE="true" FIELDS="itemid, userid" COMMENT="Will usually want to find the comment by both itemid and userid"/>
      </INDEXES>
    </TABLE>
  </TABLES>
</XMLDB>